// pages/sale/sale.js
var util = require("../../utils/util.js");
var baseImgUrl = util.baseImgUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isHideLoadMore:true,
    indicatorDots: true,//是否显示轮播图的面板指示点
    autoplay:true,//轮播图是否自动播放
    colorMoren: "#fff",//指示点颜色
    colorActive: "#ff2473",//当前选中的指示点颜色
    s_imgUrls: [baseImgUrl + "lunbo.png", baseImgUrl + "lunbo.png", baseImgUrl +"lunbo.png"],//轮播图路径
    interval:5000,
    duration:1000,
    navlist: [{
      id: 1,
      url: "../images/pin1.png",
      name: "优惠券"
    }, {
      id: 2,
      url: "../images/pin2.png",
      name: "新店"
    }, {
      id: 3,
      url: "../images/pin3.png",
      name: "热销"
    }, {
      id: 4,
      url: "../images/pin4.png",
      name: "特卖"
    }],
    pingtuan: {
      title: "搭档砍价",
      subTitle: "好友砍价,更划算",
      ptSrc: "../images/kanjia.png"
    },
    xianhua: {
      title: "今日秒杀",
      subTitle: "限时秒杀,手慢无",
      ptSrc: "../images/miaosha.png"
    },
    gonggaolist: [{
      id: 0,
      tag: "hot",
      title: "测试数据1测试数据1测试数据1"
    }, {
      id: 1,
      tag: "热门",
      title: "测试数据2测试数据2测试数据2"
    }, {
      id: 2,
      tag: "hot2",
      title: "测试数据1测试数据1测试数据1"
    }, {
      id: 3,
      tag: "热门2",
      title: "测试数据2测试数据2测试数据2测试数据2测试数据2测试数据2"

    }],
    tjList: [{
      id: 0,
      title:"即可发烧购物节",
      status:0,
      statusOn:"进行中",
      statusOut:"已结束",
      picurl: baseImgUrl + "pic0.png",
      content:"活动简介活动简介活动简介活动简介"
     
    }, {
      id: 1,
        title: "双十一优惠来袭",
        status: 1,
        statusOn: "进行中",
        statusOut: "已结束",
        picurl: baseImgUrl + "pic0.png",
        content: "活动简介活动简介活动简介活动简介活动简介活动简介活动简介活动简介活动简介活动简介活动简介活动简介"
      }, {
        id: 2,
        title: "即可发烧购物节",
        status: 0,
        statusOn: "进行中",
        statusOut: "已结束",
        picurl: baseImgUrl + "pic0.png",
        content: "活动简介活动简介活动简介活动简介"
    }, {
      id: 3,
        title: "即可发烧购物节",
        status: 1,
        statusOn: "进行中",
        statusOut: "已结束",
        picurl: baseImgUrl + "pic0.png",
        content: "活动简介活动简介活动简介活动简介"

    }],
    tjhd:{
      top:"推荐活动",
      bot:"The recommended activities"
    }
  },
/**********进入砍价********************/
kanjian:function(){
   wx.navigateTo({
       url: '/pages/kanjian/kanjian',
     })
},
/*********进入今日秒杀**********/
  miaosha:function(){
     wx.navigateTo({
       url: '/pages/miaosha/miaosha',
     })
  },

  /************点击进入即客惠报详情页*****************/
  goto_jkhb:function(e){
    console.log(e)
    var that=this;
    var thisId=e.currentTarget.dataset.id;
    console.log("你点击的是id号为"+thisId+"的新闻");
    wx.navigateTo({
      url: '/pages/jkhuibao/jkhuibao?id='+thisId,

    })
  },

/************进入推荐活动 更多****************/
  getmore:function(){
    wx.navigateTo({
      url: '/pages/huodong/huodong',
    })
  },

/************点击进入活动详情************ */
  gotodetail:function(){
    wx.navigateTo({
      url: '/pages/hd_detail/hd_detail',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },



  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

     var that=this;
     var arr=[]
    wx.showLoading({
      title: '玩儿命加载中...',
    })
     setTimeout(function(){
       wx.hideLoading()
       arr = arr.concat(that.data.tjList);
       console.log(arr);
       //测试数据
       var arr_lishi = that.data.tjList;

       arr = arr.concat(arr_lishi)
       console.log(arr);
       that.setData({
         tjList: arr
       })
     },1000)
    
  },
  /**********导航栏跳转************/
  navDetail:function(e){
    var index=e.currentTarget.dataset.index;
    switch (index){
      case 0: wx.navigateTo({
        url: '/pages/youhuiquan/youhuiuquan',
      });
      break;
      case 1: wx.navigateTo({
        url: '../navDetail/navDetail?index='+index,
      }); break;
      case 2: wx.navigateTo({
        url: '../navDetail/navDetail?index=' + index,
      }); break;
      case 3: wx.navigateTo({
        url: '../navDetail/navDetail?index=' + index,
      }); break;
    }



  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})